package com.suning.app.snpaasadmin.operation;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.suning.app.snpaasadmin.dao.CfServiceMapper;
import com.suning.app.snpaasadmin.pojo.CfService;
import com.suning.app.snpaasadmin.pojo.CfServiceExample;

public class CfServiceDBOperation {
	public List<CfService> getCfServiceList() {
		SqlSession sqlSession = FactoryBase.getSession().openSession();
		CfServiceMapper csMapper = sqlSession.getMapper(CfServiceMapper.class);
		
		CfServiceExample csEx = new CfServiceExample();
		csEx.createCriteria();
		List<CfService> csList = csMapper.selectByExample(csEx);
		
		sqlSession.close();
		return csList;
		
	}

	public CfService getService(Integer serviceId) {
		SqlSession sqlSession = FactoryBase.getSession().openSession();
		CfServiceMapper csMapper = sqlSession.getMapper(CfServiceMapper.class);
		
		CfService cs = csMapper.selectByPrimaryKey(serviceId);
		sqlSession.close();
		return cs;
	}

}
